<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件绑定</title>
  <script type="text/javascript" src="../js/jquery-3.4.1.min.js"></script>
  <script>
$(function (){
//   给指定的元素绑定一个数据
  $("#id").data("id",1)
  $("#d1").data("username","admin")
  $("#query").click(function (){
    console.log($("#d1").data("id"))
    console.log($("#d1").data("username"))
  })
  $("#modify").click(function(){
    $("#d1").data("id",2);
    $("#query").data("id",3)
  });
  $("#delete").click(function(){
    $("#d1").removeData("id");
  })
})
  </script>
</head>
<body>
<div id="d1"></div>
<button id="query">查询</button>
<button id="modify">修改</button>
<button id="delete">删除</button>
</body>
</html>